<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="breadcrumbs">
        <h:form>
            <a href="index.xhtml">Website Admin</a><div class="breadcrumb_divider"></div>
            <h:commandLink action="#{examsController.prepareList()}" value="Exams"/>
            <div class="breadcrumb_divider"></div><a class="current">Details</a>
        </h:form>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form" id="form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorClass="errorStyle" infoClass="infoStyle" layout="table" >
                    </h:messages>
                </h:panelGroup>
                <article class="module width_full">
			<header><h3>Exam details</h3></header>
                        <div class="module_content">
                <h:panelGrid columns="4" width="100%">
                    <h:outputText value="#{bundle.ViewExamsLabel_id}"/>
                    <h:outputText value="#{examsController.selected.id}" title="#{bundle.ViewExamsTitle_id}"/>
                    <h:outputText value="#{bundle.ViewExamsLabel_dateCreate}"/>
                    <h:outputText value="#{examsController.selected.dateCreate}" title="#{bundle.ViewExamsTitle_dateCreate}">
                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                    </h:outputText>
                    <h:outputText value="#{bundle.ViewExamsLabel_dateStart}"/>
                    <h:outputText value="#{examsController.selected.dateStart}" title="#{bundle.ViewExamsTitle_dateStart}">
                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                    </h:outputText>
                    <h:outputText value="#{bundle.ViewExamsLabel_dateEnd}"/>
                    <h:outputText value="#{examsController.selected.dateEnd}" title="#{bundle.ViewExamsTitle_dateEnd}">
                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                    </h:outputText>
                    <h:outputText value="#{bundle.ViewExamsLabel_dateReCounting}"/>
                    <h:outputText value="#{examsController.selected.dateReCounting}" title="#{bundle.ViewExamsTitle_dateReCounting}">
                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                    </h:outputText>
                    <h:outputText value="Assign to:"/>
                    <h:outputText value="#{examsController.selected.assignFac.firstName} #{examsController.selected.assignFac.lastName}" title="#{bundle.ViewExamsTitle_status}"/>
                    <h:outputText value="Subject"/>
                    <h:outputText value="#{examsController.selected.subjectId.suName}" title="#{bundle.ViewExamsTitle_subjectId}"/>
                </h:panelGrid>
                            
                <br />
                <p:dataTable id="studentTable" var="item" value="#{examsController.selected.studentExamsList}" editable="true" widgetVar="studentAble">  
                    
                    <f:facet name="header">  
                        Mark details  
                    </f:facet>
                    <p:ajax event="rowEdit" listener="#{examsController.onEdit}" update=":form:messagePanel" />  
                    <p:column headerText="Roll No." sortBy="#{item.studentId.enRoll}">  
                                #{item.studentId.enRoll}  
                            </p:column>
                    <p:column headerText="Student name" sortBy="#{item.studentId.stuName}">  
                                #{item.studentId.stuName}  
                    </p:column>
                     <p:column headerText="Mark" >  
                        <p:cellEditor>  
                            <f:facet name="output"><h:outputText value="#{item.mark}" /></f:facet>  
                            <f:facet name="input">  
                                <h:selectOneMenu value="#{item.mark}" style="width:100%">  
                                    <f:selectItems value="#{examsController.listMark}" var="man" itemLabel="#{man}" itemValue="#{man}" />  
                                </h:selectOneMenu>  
                            </f:facet>  
                        </p:cellEditor>  
                    </p:column>  
                    <p:column headerText="Remark">  
                                <p:cellEditor>  
                                    <f:facet name="output"><h:outputText value="#{item.remark}" /></f:facet>  
                            <f:facet name="input">  
                                <h:selectOneMenu value="#{item.remark}" style="width:100%">  
                                    <f:selectItems value="#{examsController.listMark}" var="man" itemLabel="#{man}" itemValue="#{man}" />  
                                </h:selectOneMenu>  
                            </f:facet>  
                        </p:cellEditor> 
                    </p:column> 
                    <p:column style="width:6%">  
                        <p:rowEditor />  
                    </p:column> 
                </p:dataTable>
                <br />
                </div></article>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
